package com.ethink.warehouse.facade.impl;

import com.ethink.warehouse.api.request.SubWarehouseStatusSetRequest;
import com.ethink.warehouse.common.mapper.SubWarehouseMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ethink.warehouse.api.SubWarehouseFacade;
import com.ethink.warehouse.api.info.SubWarehouseInfo;
import com.ethink.warehouse.api.request.SubWarehouseAddRequest;
import com.ethink.warehouse.api.request.SubWarehouseQueryRequest;
import com.ethink.warehouse.api.request.SubWarehouseUpdateRequest;
import com.ethink.warehouse.api.response.SubWarehouseAddResponse;
import com.ethink.warehouse.service.SubWarehouseService;
import java.util.List;

/**
 * 仓库分仓 Facade接口实现
 *
 * @author default
 * @date 2022-11-01
 */
@RestController
@Slf4j
@RequestMapping("warehouse-service/facade/v1/subWarehouse")
public class SubWarehouseFacadeImpl implements SubWarehouseFacade {

    @Autowired
    private SubWarehouseMapper subWarehouseMapper;

    @Autowired
    private SubWarehouseService subWarehouseService;

    @Override
    public Page<SubWarehouseInfo> querySubWarehouse(SubWarehouseQueryRequest request) {
        return subWarehouseService.querySubWarehouse(request);
    }

    @Override
    public SubWarehouseInfo getSubWarehouseById(Long subWarehouseId) {
        return subWarehouseService.getSubWarehouseById(subWarehouseId);
    }

    @Override
    public SubWarehouseInfo getSubWarehouseByCode(String subWarehouseCode) {
        return subWarehouseMapper.getSubWarehouseByCode(subWarehouseCode);
    }

    @Override
    public List<SubWarehouseInfo> listSubWarehouse() {
        return subWarehouseService.listSubWarehouse();
    }

    @Override
    public SubWarehouseAddResponse addSubWarehouse(SubWarehouseAddRequest request) {
        return subWarehouseService.addSubWarehouse(request);
    }

    @Override
    public void updateSubWarehouse(SubWarehouseUpdateRequest request) {
        subWarehouseService.updateSubWarehouse(request);
    }

    @Override
    public void setSubWarehouseStatus(SubWarehouseStatusSetRequest request) {
        subWarehouseService.setSubWarehouseStatus(request);
    }

}